package oct2013;

/**
 * @author Yinzi Chen
 * @date Nov 14, 2013
 */
public class RemoveElement {
    public int removeElement(int[] A, int elem) {
        int n = A.length;
        int i = 0, j = 0;
        while (j < n) {
            if (A[j] != elem) {
                A[i++] = A[j];
            }
            j++;
        }
        return i;
    }
}
